package edu.mtu.citizenscience.streamapplication.activity.main.reports;

import android.util.Log;

/**
 * @author Bryan Becker <bcbecker@mtu.edu>
 * @copyright (c) 2013 MichiganTech <http://www.mtu.edu>
 * 
 * Model Report class to store a simplified version of our reports
 * that will be used to display information in our Manage Reports 
 * Activity. When we display a list of our reports, we only need to
 * know the row id, the stream name, and the creation date. Therefore,
 * we can store this information in a simplified report class.
 * 
 * **NOTE** Need to implement a constructor class and change the code
 * in other classes for easier use.
 */
public class ModelReport {
	   
	//Stream Name of our report
    private String streamName;
    //Creation Date of our report
    private String date;
    //Row ID of our report
    private long id;
   
	/**
	 * Get the row id of our report
	 * 
	 * @param   void
	 * @return	long
	 */
    public long getID() {
    	return id;
    }
    
	/**
	 * Set the row id of our report
	 * 
	 * @param   void
	 * @return	void
	 */
    public void setID(long id){
    	this.id = id;
    }
    
	/**
	 * Get the stream name of our report
	 * 
	 * @param   void
	 * @return	String
	 */
    public String getStreamName() {
        return streamName;
    }
    
	/**
	 * Set the stream name of our report
	 * 
	 * @param   void
	 * @return	void
	 */
    public void setStreamName(String stream) {
        this.streamName = stream;
    }
    
	/**
	 * Get the creation date of our report
	 * 
	 * @param   void
	 * @return	String
	 */
    public String getDate() {
        return date;
    }
    
	/**
	 * Set the stream name of our report
	 * 
	 * @param   void
	 * @return	void
	 */
    public void setDate(String date) {
    	//current date and time
    	String currentDateTime;
    	
    	//if we were given a valid date input
    	if(date.length() >= 16){
    		//set up our date to display "Created: 10/11/12"
    		currentDateTime ="Created: " + date.substring(0, 11) + "  ";
    		
    		//get the hour it was created
    		int hour = Integer.parseInt(date.substring(11,13));
    		
    		//display it in standard time with PM and AM instead of military time for simplicity
    		if(hour > 12){
    			hour = hour - 12;
    			currentDateTime = currentDateTime + hour + date.substring(13,16) + " PM";
    		}
    		else{
    			currentDateTime = currentDateTime + date.substring(11,16) + " AM";
    		}
    	}
    	else{
    		Log.w("ERROR", "WUT");
    		currentDateTime = date;
    	}
    	
    	this.date = currentDateTime;
    }
}